package design.simdi.code.final_paper.site.panels.administrare;

import org.apache.wicket.model.LoadableDetachableModel;

import design.simdi.code.final_paper.core.daos.PersonDao;
import design.simdi.code.final_paper.core.entities.Person;

/**
 * 
 * @author Marius Dumitriu - (Jun 21, 2010 - 3:29:36 PM)
 * 
 */
public class DetachablePersonModel extends LoadableDetachableModel<Person> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private final long id;
	private final PersonDao personDao;

	public DetachablePersonModel(Person object, PersonDao personDao) {
		super(object);
		this.id = object.getId();
		this.personDao = personDao;
	}

	@Override
	protected Person load() {
		return personDao.get(id);
	}

}
